/**
 * Copyright (c) 2017-2018, zengjintao (1913188966@qq.com).
 * <p>
 * Licensed under the GNU Lesser General Public License (LGPL) ,Version 3.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.gnu.org/licenses/lgpl-3.0.txt
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.jfast.framework.web.config;

import java.util.HashSet;
import java.util.Set;

import com.jfast.framework.kit.StrKit;
import com.jfast.framework.util.ClassScanner;
import com.jfast.framework.web.annotation.ConfigurationProperties;


@ConfigurationProperties(prefix="jfast.config")
public  class JfastConfig {

    static final String DEFAULT_VIEW_PATH = "/";
	
    public static final String JSP = "jsp";
    public static final String VELOCITY = "velocity";
    public static final String JFINAL = "jfinal";
    
    private String baseViewPath = "";
	
    private String viewType;
    
    private String suffix;//视图后缀

	@SuppressWarnings("unused")
	private String jars;
    
    private Set<String> set = new HashSet<>();
    
    /**
     * 设置要扫描的jar包(多个jar包以,隔开)
     * @param jars
     */
    public void setJars(String jars) {
    	if(jars.contains(",")){
			for(String jar : StrKit.spilt(jars)){
				set.add(jar);
			}
		}else{
			set.add(jars);
		}
    	ClassScanner.addJars(set);
	}
    
    public String getSuffix() {
		return suffix;
	}

	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}
	
    public Set<String> getSet() {
		return set;
	}

	public String getViewType() {
		return viewType;
	}

	/**
	 * 设置视图类型
	 * @param viewType
	 */
	public void setViewType(String viewType) {
		this.viewType = viewType;
	}

	
	public String getBaseViewPath() {
		return baseViewPath;
	}

	/**
	 * 设置页面存放路径
	 * @param baseViewPath
	 * @return
	 */
	public JfastConfig setBaseViewPath(String baseViewPath) {
		this.baseViewPath = baseViewPath;
		return this;
	}
}

